/*
 * User: user
 * Date: 30/12/2007
 * Time: 00:51:32
 */
package org.conann.instrument.md;

import com.google.common.base.Supplier;
import com.google.common.collect.Multimaps;
import com.google.common.collect.SetMultimap;
import org.conann.metadata.AnnotationType;

import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
 Compile-time element
 */
public class CtElement<T> {

    private final SetMultimap<AnnotationType, Annotation> annotations = createAnnotationsMap();
    private final T element;

    public CtElement (T element) {
        this.element = element;
    }

    private SetMultimap<AnnotationType, Annotation> createAnnotationsMap () {
        return Multimaps.newSetMultimap(new ConcurrentHashMap<AnnotationType, Collection<Annotation>>(), new Supplier<Set<Annotation>>() {
            public Set<Annotation> get () {
                return new HashSet<Annotation>();
            }
        });
    }
}